<div class="lookupForm">


  <div class="item no-padding">

    <!--<div class="button button-small button-text button-stable button-icon-event padding no-padding-right ink"
         ng-repeat="filter in search.filters" ng-if="filter">
      <span ng-bind-html="'DOCUMENT.LOOKUP.TX_SEARCH_FILTER.'+filter.type|translate:filter"></span>
      <i class="icon ion-close" ng-click="itemRemove($index)"></i>

    </div>-->

    <label class="item-input">
      <i class="icon ion-search placeholder-icon"></i>
      <input type="text"
             class="visible-xs visible-sm"
             placeholder="{{'DOCUMENT.LOOKUP.SEARCH_HELP'|translate}}"
             ng-model="search.text"
             ng-model-options="{ debounce: 650 }"
             ng-change="doSearchText()">
      <input type="text"
             class="hidden-xs hidden-sm"
             id="{{searchTextId}}" placeholder="{{'DOCUMENT.LOOKUP.SEARCH_HELP'|translate}}"
             ng-model="search.text"
             on-return="doSearchText()">
      <div class="helptip-anchor-center">
        <a id="{{helptipPrefix}}-search-text"></a>
      </div>

    </label>
  </div>


  <div class="padding-top padding-xs" style="display: block; height: 60px;">
    <div class="pull-left">
      <h4
        ng-if="search.last" translate>
        DOCUMENT.LOOKUP.LAST_DOCUMENTS
      </h4>
      <h4 ng-if="!search.last">
        {{'COMMON.RESULTS_LIST'|translate}}
      </h4>
      <h5 class="dark" ng-if="!search.loading && search.total">
        <span translate="COMMON.RESULTS_COUNT" translate-values="{count: search.total}"></span>
        <small class="gray" ng-if=":rebind:search.took && expertMode">
          - {{:rebind:'COMMON.EXECUTION_TIME'|translate: {duration: search.took} }}
        </small>
        <small class="gray" ng-if=":rebind:expertMode && search.filters && search.filters.length">
          - <a ng-click="toggleShowQuery()"
            ng-if="!showQuery" >
            <span translate>DOCUMENT.LOOKUP.SHOW_QUERY</span>
            <i class="icon ion-arrow-down-b gray"></i>
          </a>
          <a ng-click="toggleShowQuery()"
             ng-if="showQuery" >
            <span translate>DOCUMENT.LOOKUP.HIDE_QUERY</span>
             <i class="icon ion-arrow-up-b gray"></i>
          </a>
        </small>
      </h5>
      <h5 class="gray" ng-if="search.loading" >
        <ion-spinner class="icon ion-spinner-small" icon="android"></ion-spinner>
        <span translate>COMMON.SEARCHING</span>
        <br/>
      </h5>
    </div>

    <div class=" pull-right hidden-xs hidden-sm">
      <a class="button button-text button-small ink"
         ng-if="login"
         ng-click="showActionsPopover($event)">
        {{'DOCUMENT.LOOKUP.BTN_ACTIONS' | translate}}
        <i class="icon ion-arrow-down-b"></i>
      </a>
      &nbsp;
      <button class="button button-small button-stable ink"
              ng-click="doSearchText()">
        {{'COMMON.BTN_SEARCH' | translate:search}}
      </button>
    </div>
  </div>

  <div class="item no-border no-padding" ng-if=":rebind:search.filters && search.filters.length && expertMode">
    <small class="no-padding no-margin" ng-if="showQuery">
      <span class="gray text-wrap dark">{{:rebind:search.query}}</span>
    </small>
  </div>

  <ion-list class="list" ng-class="::motion.ionListClass">

    <ng-include src="'plugins/es/templates/document/items_documents.html'"></ng-include>

  </ion-list>

  <ion-infinite-scroll
    ng-if="search.hasMore"
    spinner="android"
    on-infinite="showMore()"
    distance="1%">
  </ion-infinite-scroll>

